package com.leadingsoft.pwxk.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import com.leadingsoft.pwxk.converter.AuditSelfMonitorConverter;
import com.leadingsoft.pwxk.dto.AuditSelfMonitorDto;
import com.leadingsoft.pwxk.model.AuditSelfMonitor;
import com.leadingsoft.pwxk.service.AuditSelfMonitorService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 
 * @author ysh
 * @desc 自行监测相关
 */
@RestController
@Api(description = "自行监测相关")
@RequestMapping("api/auditSelfMonitor")
public class AuditSelfMonitorController {

	@Autowired
	AuditSelfMonitorService auditSelfMonitorService;

	@Autowired
	AuditSelfMonitorConverter auditSelfMonitorConverter;

	@ApiOperation("自行监测信息")
	@GetMapping(path = "{dataId}")
	@ResponseStatus(code = HttpStatus.OK)
	public AuditSelfMonitorDto get(@PathVariable(value = "dataId") String dataId) {
		AuditSelfMonitor auditSelfMonitor = auditSelfMonitorService.getByDataId(dataId);
		return auditSelfMonitorConverter.toDto(auditSelfMonitor);
	}
}
